/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package service;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author andrew
 */
@Entity
@Table(name = "Planet")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Planet.findAll", query = "SELECT p FROM Planet p"),
    @NamedQuery(name = "Planet.findByIdPlanet", query = "SELECT p FROM Planet p WHERE p.idPlanet = :idPlanet"),
    @NamedQuery(name = "Planet.findByTitle1", query = "SELECT p FROM Planet p WHERE p.title1 = :title1"),
    @NamedQuery(name = "Planet.findByTitle2", query = "SELECT p FROM Planet p WHERE p.title2 = :title2"),
    @NamedQuery(name = "Planet.findByTitle3", query = "SELECT p FROM Planet p WHERE p.title3 = :title3"),
    @NamedQuery(name = "Planet.findByAddress", query = "SELECT p FROM Planet p WHERE p.address = :address"),
    @NamedQuery(name = "Planet.findByZipCode", query = "SELECT p FROM Planet p WHERE p.zipCode = :zipCode"),
    @NamedQuery(name = "Planet.findByProvince", query = "SELECT p FROM Planet p WHERE p.province = :province"),
    @NamedQuery(name = "Planet.findByMunicipality", query = "SELECT p FROM Planet p WHERE p.municipality = :municipality"),
    @NamedQuery(name = "Planet.findByLatitude", query = "SELECT p FROM Planet p WHERE p.latitude = :latitude"),
    @NamedQuery(name = "Planet.findByLongitude", query = "SELECT p FROM Planet p WHERE p.longitude = :longitude"),
    @NamedQuery(name = "Planet.findByDescription", query = "SELECT p FROM Planet p WHERE p.description = :description"),
    @NamedQuery(name = "Planet.findByCoordinatePositionX", query = "SELECT p FROM Planet p WHERE p.coordinatePositionX = :coordinatePositionX"),
    @NamedQuery(name = "Planet.findByCoordinatePositionY", query = "SELECT p FROM Planet p WHERE p.coordinatePositionY = :coordinatePositionY"),
    @NamedQuery(name = "Planet.findByShortLabel", query = "SELECT p FROM Planet p WHERE p.shortLabel = :shortLabel"),
    @NamedQuery(name = "Planet.findByReferenceName", query = "SELECT p FROM Planet p WHERE p.referenceName = :referenceName")})
public class Planet implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "emotionalFilter")
    private int emotionalFilter;
    @Column(name = "controlled")
    private Integer controlled;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idPlanet")
    private Integer idPlanet;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "title1")
    private String title1;
    @Size(max = 20)
    @Column(name = "title2")
    private String title2;
    @Size(max = 20)
    @Column(name = "title3")
    private String title3;
    @Size(max = 45)
    @Column(name = "address")
    private String address;
    @Size(max = 5)
    @Column(name = "zipCode")
    private String zipCode;
    @Size(max = 2)
    @Column(name = "province")
    private String province;
    @Size(max = 30)
    @Column(name = "municipality")
    private String municipality;
    @Size(max = 16)
    @Column(name = "latitude")
    private String latitude;
    @Size(max = 16)
    @Column(name = "longitude")
    private String longitude;
    @Size(max = 70)
    @Column(name = "description")
    private String description;
    @Column(name = "coordinatePositionX")
    private Integer coordinatePositionX;
    @Column(name = "coordinatePositionY")
    private Integer coordinatePositionY;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "shortLabel")
    private String shortLabel;
    @Size(max = 50)
    @Column(name = "referenceName")
    private String referenceName;
    @JoinTable(name = "Planet_has_Tag", joinColumns = {
        @JoinColumn(name = "Planet_idPlanet", referencedColumnName = "idPlanet")}, inverseJoinColumns = {
        @JoinColumn(name = "Tag_idTag", referencedColumnName = "idTag")})
    @ManyToMany
    private Collection<Tag> tagCollection;
    @JoinTable(name = "Planet_isConnectedTo_Planet", joinColumns = {
        @JoinColumn(name = "Planet_idPlanet", referencedColumnName = "idPlanet")}, inverseJoinColumns = {
        @JoinColumn(name = "Planet_idPlanet1", referencedColumnName = "idPlanet")})
    @ManyToMany
    private Collection<Planet> planetCollection;
    @ManyToMany(mappedBy = "planetCollection")
    private Collection<Planet> planetCollection1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "planetidPlanet")
    private Collection<PhotoCollection> photoCollectionCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "planetidPlanet")
    private Collection<Audio> audioCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "planetidPlanet")
    private Collection<Connection> connectionCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "planetidPlanet")
    private Collection<Video> videoCollection;
    @JoinColumn(name = "Universe_idUniverse", referencedColumnName = "idUniverse")
    @ManyToOne(optional = false)
    private Universe universeidUniverse;

    public Planet() {
    }

    public Planet(Integer idPlanet) {
        this.idPlanet = idPlanet;
    }

    public Planet(Integer idPlanet, String title1, String shortLabel) {
        this.idPlanet = idPlanet;
        this.title1 = title1;
        this.shortLabel = shortLabel;
    }

    public Integer getIdPlanet() {
        return idPlanet;
    }

    public void setIdPlanet(Integer idPlanet) {
        this.idPlanet = idPlanet;
    }

    public String getTitle1() {
        return title1;
    }

    public void setTitle1(String title1) {
        this.title1 = title1;
    }

    public String getTitle2() {
        return title2;
    }

    public void setTitle2(String title2) {
        this.title2 = title2;
    }

    public String getTitle3() {
        return title3;
    }

    public void setTitle3(String title3) {
        this.title3 = title3;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getZipCode() {
        return zipCode;
    }

    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getMunicipality() {
        return municipality;
    }

    public void setMunicipality(String municipality) {
        this.municipality = municipality;
    }

    public String getLatitude() {
        return latitude;
    }

    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }

    public String getLongitude() {
        return longitude;
    }

    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getCoordinatePositionX() {
        return coordinatePositionX;
    }

    public void setCoordinatePositionX(Integer coordinatePositionX) {
        this.coordinatePositionX = coordinatePositionX;
    }

    public Integer getCoordinatePositionY() {
        return coordinatePositionY;
    }

    public void setCoordinatePositionY(Integer coordinatePositionY) {
        this.coordinatePositionY = coordinatePositionY;
    }

    public String getShortLabel() {
        return shortLabel;
    }

    public void setShortLabel(String shortLabel) {
        this.shortLabel = shortLabel;
    }

    public String getReferenceName() {
        return referenceName;
    }

    public void setReferenceName(String referenceName) {
        this.referenceName = referenceName;
    }

    @XmlTransient
    public Collection<Tag> getTagCollection() {
        return tagCollection;
    }

    public void setTagCollection(Collection<Tag> tagCollection) {
        this.tagCollection = tagCollection;
    }

    @XmlTransient
    public Collection<Planet> getPlanetCollection() {
        return planetCollection;
    }

    public void setPlanetCollection(Collection<Planet> planetCollection) {
        this.planetCollection = planetCollection;
    }

    @XmlTransient
    public Collection<Planet> getPlanetCollection1() {
        return planetCollection1;
    }

    public void setPlanetCollection1(Collection<Planet> planetCollection1) {
        this.planetCollection1 = planetCollection1;
    }

    @XmlTransient
    public Collection<PhotoCollection> getPhotoCollectionCollection() {
        return photoCollectionCollection;
    }

    public void setPhotoCollectionCollection(Collection<PhotoCollection> photoCollectionCollection) {
        this.photoCollectionCollection = photoCollectionCollection;
    }

    @XmlTransient
    public Collection<Audio> getAudioCollection() {
        return audioCollection;
    }

    public void setAudioCollection(Collection<Audio> audioCollection) {
        this.audioCollection = audioCollection;
    }

    @XmlTransient
    public Collection<Connection> getConnectionCollection() {
        return connectionCollection;
    }

    public void setConnectionCollection(Collection<Connection> connectionCollection) {
        this.connectionCollection = connectionCollection;
    }

    @XmlTransient
    public Collection<Video> getVideoCollection() {
        return videoCollection;
    }

    public void setVideoCollection(Collection<Video> videoCollection) {
        this.videoCollection = videoCollection;
    }

    public Universe getUniverseidUniverse() {
        return universeidUniverse;
    }

    public void setUniverseidUniverse(Universe universeidUniverse) {
        this.universeidUniverse = universeidUniverse;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPlanet != null ? idPlanet.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Planet)) {
            return false;
        }
        Planet other = (Planet) object;
        if ((this.idPlanet == null && other.idPlanet != null) || (this.idPlanet != null && !this.idPlanet.equals(other.idPlanet))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "service.Planet[ idPlanet=" + idPlanet + " ]";
    }

    public Integer getControlled() {
        return controlled;
    }

    public void setControlled(Integer controlled) {
        this.controlled = controlled;
    }

    public int getEmotionalFilter() {
        return emotionalFilter;
    }

    public void setEmotionalFilter(int emotionalFilter) {
        this.emotionalFilter = emotionalFilter;
    }
    
}
